<%@ Page language="c#" AutoEventWireup="true" Inherits="Dimok.Images.MailSelect" %>
<%@ OutputCache Duration="1" VaryByParam="none" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 

<html>
<head>
<title>MailSelect</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout" bgcolor="menu">
<form id="MailSelect" method="post" runat="server" onsubmit="return false">
<TABLE style="FONT-SIZE: xx-small; WIDTH: 100%; FONT-FAMILY: tahoma; HEIGHT: 100%" cellpadding="0" cellspacing="0">
	<TR valign="top">
		<TD align="right" style="VERTICAL-ALIGN: middle; WIDTH: 1%">To:</TD>
		<TD>
			<INPUT id="txtTo" onkeydown="setTimeout('findEMail()',100)" onfocus="this.select()" style="VERTICAL-ALIGN: text-bottom;width:100%">
		</TD>
	</TR>
	<TR>
		<TD style="HEIGHT: 100%"></TD>
		<TD style="HEIGHT: 100%">
			<ASP:LISTBOX onchange="setAddress(this)" id="selEMail" style="FONT-SIZE: xx-small; WIDTH: 100%; FONT-FAMILY: tahoma; HEIGHT: 100%" Runat="server"></ASP:LISTBOX>
		</TD>
	</TR>
	<TR>
		<TD align="right">Subject:</TD>
		<TD><INPUT id="txtSubject" style="WIDTH: 100%"></TD>
	</TR>
	<TR>
		<TD align="right">
			<INPUT type="image" onclick="unload(true)" style="VERTICAL-ALIGN: middle" src="/images/SendEMail.jpg" WIDTH="62" HEIGHT="23">
		</TD>
		<TD>
			<INPUT id="tdEMail" style="width:100%">
		</TD>
	</TR>
</TABLE>
</form>
</body>
</html>
<SCRIPT LANGUAGE="javascript">
function findEMail(){
var re = new RegExp("^"+MailSelect.txtTo.value,"i");
	for( var i=0; i < MailSelect.selEMail.length; i++ )
		if( MailSelect.selEMail[i].text.match(re) ){
			MailSelect.tdEMail.value = MailSelect.selEMail[i].value;
			return MailSelect.selEMail.selectedIndex = i;
		}
}
function setAddress(el){
	MailSelect.txtTo.value = MailSelect.selEMail[MailSelect.selEMail.selectedIndex].text;
	MailSelect.tdEMail.value = MailSelect.selEMail.value;
}
function unload(send){
	if( send )window.returnValue  = {to:MailSelect.tdEMail.value,subject:MailSelect.txtSubject.value}
	window.close();
}
</SCRIPT>
